<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
</head>
<style type="text/css">
</style>
<form class="mui-input-group">
	<div class="mui-input-row">
		<label>公司名:</label> <input type="hidden" class="compId" name="compId">
			<input type="text" class="compName" name="compName"
			placeholder="请输入公司名"> <span class="must">*</span>
	</div>
	<div class="mui-input-row">
		<label>负责人:</label> <input type="text" class="managerName"
			name="managerName" placeholder="请输负责人姓名">
	</div>
	<div class="mui-input-row">
		<label>联系电话:</label> <input type="text" class="mobilePhone"
			name="mobilePhone" placeholder="请输入手机号码">
	</div>
	<div class="mui-input-row">
		<label>备注:</label> <input type="text" class="des" name="des"
			placeholder="请输入备注">
	</div>
	<div class="mui-button-row">
		<a class="mui-btn mui-btn-primary submit">提交</a>
	</div>
</form>
<script type="text/javascript">
    	mui('#offCanvasContentScroll').scroll().scrollTo(0,0);
    
    	$(".mui-title").html("公司管理");
    	
		var comp = sessionStorage.getItem('comp');
		comp = JSON.parse(comp);
		$(".compId").attr("value",comp.compId);
		$(".compName").val(comp.compName);
		$(".managerName").val(comp.managerName);
		$(".mobilePhone").val(comp.mobilePhone);
		$(".des").val(comp.des);
		
		$("#test").on("touchstart", function(e){
		    e.stopPropagation();
		});
	
	   $(".submit").on("touchstart",function(){
		   var param = $("form").serialize();

		    let compName = $(".compName").val();
	    	
	    	if(compName !== ""){
				$.post("/comp/editOrAddComp",param,function(res){
					
					if(res.success){
						mui.toast("操作成功");
						history.back();
			    	}else{
			    		mui.toast(res.message);
			    	}
					
				})
	    	}else{
	    		mui.toast("带 "+'<span style="color:red;">*</span> 为必填项');
	    	}
	   })
	   
	</script>
</html>